// import 'dart:io';
//
// import 'dart:typed_data';
// import 'package:flutter/material.dart';
// import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
// import 'package:xsdk_flutter/xsdk/utils/x_utils_log.dart';
//
// //https://pub-web.flutter-io.cn/packages/printing
// /*
// pdf查看 目前版本与qr_code_scanner冲突,因此暂不开放
// https://pub.flutter-io.cn/packages/syncfusion_flutter_pdfviewer
//
// dependencies:
//   syncfusion_flutter_pdfviewer: ^22.1.39
// import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
//
// 其他:https://pub-web.flutter-io.cn/packages/printing
//  */
// abstract class XPDFUtils{
//
//   /*
//   pdf在asset文件夹中
//   1.在assets文件夹中创建pdfs文件夹
//   2.在pubspec.yaml配置文件中设置:
//   assets:
//     - assets/images/
//     - assets/pdfs/
//    */
//   static Widget getWidgetPdfAtAsset(String pdfName){
//     return SfPdfViewer.asset('assets/pdfs/$pdfName');
//   }
//
//   /*
//   The file path mentioned in the above code example is just for the Android platform.
//   On Android, this may require the android.permission.READ_EXTERNAL_STORAGE.
//   如:'storage/emulated/0/Download/flutter-succinctly.pdf'
//    */
//   static Widget getWidgetPdfWithFile(String filePath){
//     return SfPdfViewer.file(File(filePath));
//   }
//
//   /*
//   To load PDF from network using SfPdfViewer.network in macOS, network access must be enabled in your macOS application. On your macos/Runner/DebugProfile.entitlements file, add the following lines inside the <dict>
// tag to enable the network access in your application:
//   <key>com.apple.security.network.client</key>
// <true/>
//
//
// 支持搜索内容:
// _searchResult = _pdfViewerController.searchText('the',
//                     searchOption: TextSearchOption.caseSensitive);
//                 if (kIsWeb) {
//                   print(
//                       'Total instance count: ${_searchResult.totalInstanceCount}');
//                 } else {
//                   _searchResult.addListener(() {
//                     if (_searchResult.hasResult &&
//                         _searchResult.isSearchCompleted) {
//                       print(
//                           'Total instance count: ${_searchResult.totalInstanceCount}');
//                     }
//
//                     if (_searchResult.isSearchCompleted &&
//                       _searchResult.totalInstanceCount == 0) {
//                     print('No matches found.');
//                   }
//
//                   });
//
//
//
//
//
//   上一个: _searchResult.previousInstance();
//   下一个: _searchResult.nextInstance();
//   if (_searchResult.currentInstanceIndex ==
//                         _searchResult.totalInstanceCount &&
//                     _searchResult.isSearchCompleted) {
//                   print('No more occurrences found.');
//                 }
//
//
//   取消搜索: _searchResult.clear();
//
//
//   跳转页面:
//   _pdfViewerController.previousPage();
//   _pdfViewerController.nextPage();
//   _pdfViewerController.jumpToPage(3);
//
//    */
//   static Widget getWidgetPdfAtNetwork(
//       String pdfUrl,
//       {
//         PdfViewerController? controller, //_pdfViewerController.zoomLevel = 2;
//         PdfScrollDirection scrollDirection=PdfScrollDirection.vertical,//PdfScrollDirection.horizontal
//         PdfPageLayoutMode pageLayoutMode=PdfPageLayoutMode.continuous,//目前整页翻只支持横向: pageLayoutMode: PdfPageLayoutMode.single
//         PdfInteractionMode interactionMode=PdfInteractionMode.selection,//PdfInteractionMode.selection 允许文本选择复制, PdfInteractionMode.pan 不能选择文本复制
//       }
//       ){
//     return SfPdfViewer.network(
//       pdfUrl,
//       controller: controller,
//       //initialScrollOffset: Offset(0, 500),
//       //initialZoomLevel: 1.5
//       //canShowScrollHead: false,
//       //canShowScrollStatus: false,
//       //canShowPaginationDialog: false,
//       //canShowPageLoadingIndicator: false,
//       //canShowPasswordDialog: false, //适用带密码打开的pdf
//       //password: _password,//适用带密码打开的pdf
//       //enableDoubleTapZooming: false,//是否双击放大
//       //maxZoomLevel: 5,
//       // onZoomLevelChanged: (PdfZoomDetails details) {
//       //   print(details.newZoomLevel);
//       // },
//       //enableTextSelection: false, //选择文本的样式在App的ThemeData中设置
//       // onTextSelectionChanged: (PdfTextSelectionChangedDetails details) {
//       //   if (details.selectedText != null) {
//       //     print(details.selectedText);
//       //   }
//       // },
//       currentSearchTextHighlightColor: Colors.blue,//适用搜索结果文本样式
//       otherSearchTextHighlightColor: Colors.yellow,//适用搜索结果文本样式
//       interactionMode: interactionMode,
//       pageLayoutMode: pageLayoutMode,
//       scrollDirection: scrollDirection,
//       enableDocumentLinkAnnotation: false,//文本链接关闭
//       // enableHyperlinkNavigation: false,
//       // onHyperlinkClicked: (PdfHyperlinkClickedDetails details) {
//       //   print(details.uri);
//       // },
//       onDocumentLoaded: (PdfDocumentLoadedDetails details) {
//         XLogUtils.printLog('---pdf加载成功,总页数:${details.document.pages.count}');
//         //dynamic _pdfBookmark = details.document.bookmarks;
//
//       },
//       onDocumentLoadFailed: (PdfDocumentLoadFailedDetails details) {
//         XLogUtils.printLog('---pdf error=${details.error},${details.description}');
//       },
//     );
//   }
//
//
//   static Widget getWidgetPdfWithMemory(Uint8List bytes){
//     return SfPdfViewer.memory(bytes);
//   }
//
//
//
//
//
// }
